package com.xuecheng.controller;

import com.xuecheng.po.Dictionary;
import com.xuecheng.service.DictionaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 数据字典
 */
@Slf4j
@RestController
public class DictionaryController {
	
	@Resource
	private DictionaryService dictionaryService;
	
	@GetMapping("/dictionary/all")
	public List<Dictionary> queryAll() {
		return dictionaryService.queryAll();
	}
	
	@GetMapping("/dictionary/code/{code}")
	public Dictionary getByCode(@PathVariable String code) {
		return dictionaryService.getByCode(code);
	}
}
